<include file="Public/header"/>
<div class="wrapper m-t">

        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <a class="h5 font-bold">用户管理</a>
                <a href="{:U('AccessControl/addUser')}" class="btn btn-sm btn-primary m-l">新增</a>
            </div>
            <div class="ibox-content">

                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th width="10 "><input type="checkbox"></th>
                        <th>UID</th>
                        <th>用户名</th>
                        <th>昵称</th>
                        <th>邮箱</th>
                        <th>用户组</th>
                        <th>电话号码</th>
                        <th>最后登录时间</th>
                        <th>最后登录IP</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="_list" id="vo">
                        <tr>
                            <td><input type="checkbox" name="post[]" value="2"></td>
                            <td>{$vo.id}</td>
                            <td>{$vo.username}</td>
                            <td>{$vo.nickname}</td>
                            <td>{$vo.email}</td>

                            <td>{$vo.title}</td>
                            <td>{$vo.phone_number}</td>
                            <td><if condition="$vo.end_time neq null">{$vo.end_time|date='Y-m-d H:i:s',###}</if></td>
                            <td>{$vo.end_ip}</td>
                            <td>
                                <if condition="$vo.status eq 1">
                                    正常
                                    <else/>
                                    禁用
                                </if>
                            </td>
                            <td>
                                <a class="text-info m-r" onclick="edits({$vo.id},{$vo.group_id},'{$vo.nickname}','{$vo.phone_number}')" data-toggle="modal" data-target="#fenzu" >编辑</a>
                                <if condition="$vo.status eq 1">
                                    <a class="text-info m-r confirm ajax-get"
                                       href="__URL__/userstate/id/{$vo.id}/status/0">禁用</a>
                                    <else/>
                                    <a class="text-info m-r confirm ajax-get"
                                       href="__URL__/userstate/id/{$vo.id}/status/1">启用</a>
                                </if>

                                <a class="text-info m-r confirm ajax-get"
                                   href="__URL__/userdel/id/{$vo.id}">删除</a>
                                <a href="{:U('AccessControl/visitor?id='.$vo[id])}">访客记录</a>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
                <div class="page">{$_page}</div>
            </div>
        </div>
    </div>

<div class="modal inmodal" id="fenzu" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span>
                    <span class="sr-only">关闭</span>
                </button>
                <h3 class="font-bold text-info"><i class="fa fa-edit"></i> 修改用户组</h3>
            </div>
            <form class="form-horizontal-s" action="{:U('AccessControl/gupdate')}" method="post">
                <div class="modal-body">

                    <div class="form-group">
                        <label class="col-sm-3 control-label">昵称</label>
                        <div class="col-sm-8">

                           <input type="text" class="form-control" value="" name="nick"/>
                            <span class="help-block m-b-none text-muted">请填写新昵称</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">电话号码</label>
                        <div class="col-sm-8">

                            <input type="text" class="form-control" value="" name="phone_number"/>
                            <span class="help-block m-b-none text-muted">请填写手机号</span>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3  control-label">选择分组</label>
                        <div class="col-sm-8">
                           <select class="form-control" name="group_id">
                               <volist name="glist" id="vo">
                               <option value="{$vo.id}">{$vo.title}</option>
                               </volist>
                           </select>
                            <span class="help-block m-b-none text-muted">请选择新分组</span>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                     <input id="suid" type="hidden" value="" name="uid"/>
                </div>
                <div class="modal-footer">
                    <button type="submit" target-form="form-horizontal-s" class="ajax-post btn btn-info col-lg-2 col-lg-push-5">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>

<include file="Public/footer"/>
<script>
    function edits(uid,group_id,nickname,phone_number){
        $("#suid").val(uid);
        $("[name='group_id']").val(group_id);
        $("[name='nick']").val(nickname);
        $("[name='phone_number']").val(phone_number);
    }
</script>